package com.sl.biz.modular.ai.model;

import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.ai.openai.OpenAiChatOptions;
import org.springframework.ai.openai.api.OpenAiApi;
import org.springframework.stereotype.Component;

@Component("doubao")
public class DoubaoChatModelService implements IChatModelService{
    @Override
    public ChatModel getChatModel(String token) {

        OpenAiApi openAiApi  = OpenAiApi.builder().baseUrl("https://ark.cn-beijing.volces.com/api/v3")
                .completionsPath("/chat/completions")
                .apiKey(token).build();
//
//        //OpenAiApi.ChatModel.GPT_4_O
//        //response format wait
        OpenAiChatOptions zhiPuAiChatOptions =OpenAiChatOptions.builder().model("doubao-1-5-thinking-pro-m-250415")
                .temperature(0.7).build();
//

        ChatModel myChatModel =  OpenAiChatModel.builder().openAiApi(openAiApi).defaultOptions(zhiPuAiChatOptions).build();
//
        return myChatModel;
    }
}
